package com.fractal;
import android.app.Dialog;
import android.content.Context;
import android.os.Bundle;
import android.view.View;
import android.widget.Button;
import android.widget.EditText;

public class SetIterations extends Dialog {

    public interface ReadyListener {
        public void ready(String name);
    }

    private ReadyListener readyListener;
    EditText number;

    public SetIterations(Context context, String name,
            ReadyListener readyListener) {
        super(context);
        this.readyListener = readyListener;
    }

    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.popup);
        setTitle("Set Iterations: ");
        Button buttonOK = (Button) findViewById(R.id.Button01);
        buttonOK.setOnClickListener(new OKListener());
        number = (EditText) findViewById(R.id.EditText01);
    }

    private class OKListener implements android.view.View.OnClickListener {
        @Override
        public void onClick(View v) {
            readyListener.ready(String.valueOf(number.getText()));
            SetIterations.this.dismiss();
        }
    }

}